<?php echo View::factory('ae/header')->bind('head_arr', $head_arr) ?>
	<?php if (isset($opt) && ($opt == 'edit' || $opt == 'publish')){?>
    <div class="content-box">
      <div class="content-box-header">
        <h3>文章列表</h3>
      </div>
      <div class="content-box-content">
        <div class="tab-content default-tab">
          <div <?php if (empty($err_msg)) echo 'style="display: none;"'; ?> class="notification attention png_bg">
          	<a href="#" class="close"><img src="/ae/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
            <div><?php echo $err_msg; ?></div>
          </div>
          <script type="text/javascript">
          $(document).ready(function(){
              // 摘要字数
              $('#summary').bind('keyup mouseup change', function(){
            	  summary_count = $(this).val().length;
            	  $('#summary-count').text(summary_count);
              });
          });
          </script>
          <form action="" method="post">
            <fieldset>
            <p>
              <label>标题</label>
              <input class="text-input medium-input" type="text" id="title" name="title" value="<?php if (isset($article_cont['title'])) echo $article_cont['title'];?>" />
              <!-- Classes for text-input: small-input, medium-input, large-input -->
              <span class="input-notification success" style="display: none;">正确</span>
            </p>
            <p>
              <label>类型</label>
              <select name="category" class="small-input">
              	<option value="0">文章类型</option>
              	<?php
              	foreach ($category as $key => $per){
					if (isset($article_cont['category']) && $article_cont['category'] == $key){
						echo "<option value=\"{$key}\" selected=\"selected\">{$per}</option>";
					}else {
						echo "<option value=\"{$key}\">{$per}</option>";
					}
				}
              	?>
              </select>
            </p>
            <p>
              <label>作者</label>
              <input class="text-input small-input" type="text" id="author" name="author" value="<?php if (isset($article_cont['author']))echo $article_cont['author'];?>" />
              <span class="input-notification success" style="display: none;">正确</span>
            </p>
            <p>
              <label>来自</label>
              <input class="text-input small-input" type="text" id="quote_from" name="quote_from" value="<?php if (isset($article_cont['quote_from']))echo $article_cont['quote_from'];?>" />
              <span class="input-notification success" style="display: none;">正确</span>
            </p>
            <p>
              <label>标签</label>
              <input class="text-input medium-input" type="text" id="tags" name="tags" value="<?php if (isset($article_cont['tags']))echo $article_cont['tags'];?>" />
              <span class="input-notification success" style="display: none;">正确</span>
              <br />
              <small>多个标签以 “,”(逗号) 分隔</small>
            </p>
            <p>
              <label>摘要</label>
              <textarea class="text-input textarea" id="summary" name="summary" cols="79" rows="9"><?php if (isset($article_cont['summary']))echo $article_cont['summary'];?></textarea>
              <span class="input-notification information">摘要字数: <span id="summary-count">0</span>（建议200字）</span>
            </p>
            <p>
              <label>内容</label>
              <textarea class="text-input textarea" id="textarea" name="content" cols="79" rows="15"><?php if (isset($article_cont['content']))echo $article_cont['content'];?></textarea>
              <script type="text/javascript" src="/ueditor/ueditor.config.js"></script>
              <script type="text/javascript" src="/ueditor/ueditor.all.min.js"></script>
              <script type="text/javascript" charset="utf-8" src="/ueditor/lang/zh-cn/zh-cn.js"></script>
              <script type="text/javascript">
              	UE.getEditor('textarea');
              </script>
            </p>
            <p>
              <input class="button" type="submit" value=" 发 布 " />
            </p>
            </fieldset>
            <div class="clear"></div>
          </form>
        </div>
      </div>
    </div>
    
    <?php }else {?>
    <div class="content-box">
      <div class="content-box-header">
        <h3>文章列表</h3>
        <ul class="content-box-tabs">
          <li><a href="/ae/article/compile"><strong>发表</strong></a></li>
        </ul>
        <div class="clear"></div>
      </div>
      <div class="content-box-content">
        <div class="tab-content default-tab">
          <div style="display: none;" class="notification attention png_bg">
          	<a href="#" class="close"><img src="/ae/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
            <div>这里放提示信息。</div>
          </div>
          <table>
            <thead>
              <tr>
                <th><input class="check-all" type="checkbox" /> id</th>
                <th>标题</th>
                <th>类型</th>
                <th>作者</th>
                <th>阅读数</th>
                <th>发表时间</th>
                <th>操作</th>
              </tr>
            </thead>
            <form action="/ae/article/operate" method="post">
            <tbody>
              <?php foreach ($list as $record){?>
              <tr>
                <td><input type="checkbox" name="aids[]" value="<?php echo $record['aid']?>" /><?php echo $record['aid']?></td>
                <td><?php echo $record['title']?></td>
                <td><?php echo isset($category[$record['category']]) ? $category[$record['category']] : '<span style="color:red">Error</span>'?></td>
                <td><?php echo $record['author']?></td>
                <td><?php echo $record['read']?></td>
                <td><?php echo $record['addtime']?></td>
                <td>
                  <a href="/detail/index/<?php echo $record['aid']?>/preview/" target="_blank" title="预览"><img src="/ae/images/icons/preview.png" style="width: 16px; height: 16px;" alt="预览" /></a>
                  <a href="/ae/article/operate/release/<?php echo $record['aid']?>" title="发布"><img src="/ae/images/icons/release.png" style="width: 16px; height: 16px;" alt="发布" /></a>
                  <a href="/ae/article/compile/edit/<?php echo $record['aid']?>" title="编辑"><img src="/ae/images/icons/pencil.png" alt="编辑" /></a>
                  <a href="/ae/article/operate/del/<?php echo $record['aid']?>" title="删除"><img src="/ae/images/icons/cross.png" alt="删除" /></a>
                </td>
              </tr>
              <?php }?>
            </tbody>
            <tfoot>
              <tr>
                <td colspan="7">
                  <div class="bulk-actions align-left">
                    <select name="opt">
                      <option value="del">删除</option>
                      <option value="shield">屏蔽</option>
                      <option value="release">发布</option>
                    </select>
                    <input class="button" type="submit" value="批量操作" />
                  </div>
                  <div class="pagination">
                  	<?php echo $page_html;?>
                  </div>
                  <div class="clear"></div>
                </td>
              </tr>
            </tfoot>
            </form>
          </table>
        </div>
      </div>
    </div>
    <?php }?>
<?php echo View::factory('ae/footer') ?>